using System.Runtime.CompilerServices;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;

namespace DA.AnimGraph {

    [BurstCompile]
    public static class AnimGraphUtility {
        [BurstCompile]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public unsafe static T* Malloc<T>() where T : unmanaged {
            var t = (T*)UnsafeUtility.Malloc(UnsafeUtility.SizeOf<T>(), UnsafeUtility.AlignOf<T>(), Allocator.Persistent);
            *t = new();
            return t;
        }
    }
}
